package cn.pink.dbsrv;

import cn.pink.core.support.Log;
import cn.pink.rpc.db.DBGrpc;
import cn.pink.rpc.db.FindHumanReply;
import cn.pink.rpc.db.FindHumanRequest;
import io.grpc.stub.StreamObserver;
import net.devh.boot.grpc.server.service.GrpcService;

/**
 * @Author: pink
 * @Date: 2022/7/13 16:33
 */
@GrpcService
public class DBService extends DBGrpc.DBImplBase {

    @Override
    public void findHuman(FindHumanRequest request, StreamObserver<FindHumanReply> responseObserver) {
        Log.db.info("db rpc findHuman handle: id={}", request);

        FindHumanReply res = FindHumanReply.newBuilder().setMessage("lailailai").build();
        responseObserver.onNext(res);
        responseObserver.onCompleted();

        Log.db.info("db rpc findHuman send: message={}", res);
    }
}
